<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑字典</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.all.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script type="text/javascript" src="../js/commonutil.js"></script>
    <script src="./function.js" charset="utf-8"></script>
</head>
<body>
<div class="edit-form-class" style="padding-top: 20px;">
    <form class="layui-form" id="editForm">
        <div class="layui-form-item">
            <label class="layui-form-label">字典类型</label>
            <div class="layui-input-block">
                <input type="text" id="type" name="type" lay-verify="required|typeVerify"  style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">字典编码</label>
            <div class="layui-input-block">
                <input type="text" id="code" name="code" lay-verify="required|codeVerify"  style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
                <input type="text" id="id" name="id" style="display:none;"  autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">字典名称</label>
            <div class="layui-input-block">
                <input type="text" id="name" name="name" lay-verify="required|nameVerify"  style="width: 350px" autocomplete="off" placeholder="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block" style="padding-top: 7px">
                <input type="checkbox" checked="" name="dictStatus" id="dictStatus" lay-skin="switch" lay-filter="required|dictStatusVerify" lay-text="启用|禁用">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block" style="width: 350px">
                <textarea placeholder="请输入内容" class="layui-textarea" id="remarks" name="remarks"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block" style="padding-left: 70px">
                <button class="layui-btn" lay-submit="" autocomplete="off" lay-filter="submitBtn" id="submitBtn">保存</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
</body>

<script>
    jQuery(function(){
        layui.use(['laypage','jquery', 'layer', 'table', 'form', 'util','upload'], function(){
            let table = layui.table;
            let laypage = layui.laypage;
            let layer = layui.layer;
            let form = layui.form;
            let  util = layui.util;
            let $ = layui.jquery;

            //初始化数据
            buildEditWin(form);
        });
    });

    //提交
    $('#submitBtn').click(function () {
        let url = serverPre + "/manager/scs/v2/dictionary/update";
        let formData = serializeObject($("#editForm"));
        let commitData = JSON.stringify({"id":formData.id,"type":formData.type,"code":formData.code,"name":formData.name,"remarks":formData.remarks,"dictStatus":formData.dictStatus === 'on' ? 1 : 0});
        submitForm(commitData,url);
    });
</script>
</html>
